Skip to content

feat: runtime package (ENG-435) - #1

Merged
malpou merged 1 commit into
mainfrom
malthe/eng-435-platform-kit-repo-with-the-runtime-package
Oct 13, 2026
Merged

malpou merged 1 commit into
mainfrom
malthe/eng-435-platform-kit-repo-with-the-runtime-package

Conversation

@malpou

@malpou malpou commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Implements the runtime contract once, for every service whose code we control (ENG-435).

What is here

  • runtime.New loads the contract's configuration names (ENVIRONMENT, LOG_LEVEL, OTEL_SERVICE_NAME, SERVICE_IDENTITY, DATABASE_URL, NATS_URL, NATS_TOKEN_FILE, REDIS_URL), builds the JSON logger and sets up tracing and metrics.
  • rt.Ready(name, check) registers a readiness check.
  • rt.Serve(ctx, handler) serves the handler on 8080, /healthz and /readyz on 8081 and /metrics on 9464, then drains and flushes when the context is done. A nil handler serves no traffic port, for workers.
  • The trace service name comes only from OTEL_SERVICE_NAME; nothing names the deployment in code.
  • example/ is a minimal service.
  • Lint config is the platform's (wrapcheck on, no diff filter), plus CI, the PR title check and release-please with plain vX.Y.Z tags.

Behaviour worth knowing

  • /healthz never runs the readiness checks. /readyz answers 503 while a check fails and once the process has begun to stop.
  • The metrics listener serves the default Prometheus registry, so OTel instruments and existing client_golang counters are both scraped.
  • Contract names are unprefixed, as the chart injects them. Anything beyond the contract is namespaced (see the README).
  • Not included: the NATS client (ENG-443) and an OTLP logs pipeline.

Tests

The tests run a small service as a child process on the real ports and assert through HTTP, stderr and an in-process OTLP receiver: the three ports and endpoints, readiness following a failing check while liveness stays up, every config name, the trace service name from config, trace ids and level in the logs, the worker mode and not-ready while draining.

One Go package for the runtime contract: configuration by the chart's
names, probes on 8081, metrics on 9464, OTel tracing named from
OTEL_SERVICE_NAME and JSON logging with trace ids. Includes an example
service, the platform lint config with wrapcheck, CI and release-please.
@malpou
malpou merged commit 2322023 into main Oct 13, 2026
3 checks passed
@malpou
malpou deleted the malthe/eng-435-platform-kit-repo-with-the-runtime-package branch October 13, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant